const week= function(year) {
    var weekArry= []
    var d = new Date(year, 0, 1); // 当前年份1月1号
    while (d.getDay() != 1) {
        d.setDate(d.getDate() + 1);
    }
    var to = new Date(year + 1, 0, 1);
    while(to.getDay() !=1) {
        to.setDate(to.getDate() + 1);
    }
    var i = 0;

    for (var from = d; from < to;) {
        i++
        let startDate, endDate, weekth;
    
        startDate= year + '.' + (from.getMonth() + 1) + '.' + from.getDate()
        
        from.setDate(from.getDate() + 6);

        if (from < to && from <= new Date(year, 11, 31)) {
            endDate= year +'.' +(from.getMonth() + 1) + '.' + from.getDate()
            from.setDate(from.getDate() + 1);
            
        }else{
            console.log(from, 'from1')
             endDate= year+1 +'.' +(from.getMonth() + 1) + '.' + from.getDate()
             from.setDate(from.getDate() + 1);
        }
        weekArry.push(
            {
                startDate: startDate, // 20190101
                endDate: endDate,// 20190101
                weekth: i
            }
        )
        //i++;
        
    }
    return weekArry;
}
export default week; 